package com.soup.lab.basic.jvm;

import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;

public class HeapTestCase {

    @Test
    public void testHeapOom() {
        List<Object> objectList = new ArrayList<>();
        while (true) {
            objectList.add(new Object());
        }
    }

    @Test
    public void testPermOom() {
        String str1 = new StringBuilder("计算机").append("软件").toString();
        System.out.println(str1.intern() == str1);
        String str2 = new StringBuilder("ja").append("va").toString();
        System.out.println(str2.intern() == str2);
    }
}
